package model;

/**
 * Abstract class representing a change card. Includes the information and
 * methods all chance cards have in common.
 * @author Group 20
 */
public abstract class Card 
{
	protected String description;
	protected int payment;
	private boolean drawn = false;
	
	/**
	 * Constructor
	 * @param description: Card description
	 */
	public Card(String description)
	{
		this.description = description;
	}
	
	/**
	 * Get the text on a chance card.
	 * @return description: String containing description
	 */
	public String getDescription()
	{
		return description;
	}
	
	/**
	 * Returns whether or not the card is drawn by a player.
	 * @return drawn: boolean value
	 */
	public boolean isDrawn() {
		return drawn;
	}

	/**
	 * Sets whether or not a card is drawn.
	 * @param drawn: boolean value
	 */
	public void setDrawn(boolean drawn) {
		this.drawn = drawn;
	}
	
	/**
	 * Get the amount of money the player earns by drawing the card.
	 * A negative number means, that the player has to pay the money instead.
	 * @return payment: int containing payment-value.
	 */
	public int getPayment()
	{
		return payment;
	}

	/**
	 * Performs the action directed by the card description, if the player has enough money.
	 * Otherwise returns false.
	 * @param player: object of type Player
	 * @return boolean: is the player able to pay
	 */
	public abstract boolean draw(Player player);


	/**
	 * toString method.
	 */
	@Override
	public String toString() {
		return ", description=" + description + ", drawn=" + drawn + "]";
	}
}
